<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Generic model for entity class, CI AR.
 * @author hmQuan
 *
 */
class MY_Model extends CI_Model {
	var $table_name;

	function __construct() {

		parent::__construct();
		$this->load->database(); 
	}

	/**
	 * General function here
	 */
	
	// public function validation_user($user_id = null, $gcm_regid = null){
	// 	if($user_id == null || !is_numeric($user_id) || $gcm_regid == null){
	// 		return null;
	// 	}

	// 	$this->db->select();
 //    	$this->db->from(T_GCMUSER);
 //    	$data = array(T_GCMUSER.'.'.GCM_REGID => $gcm_regid, T_GCMUSER.'.'.LOGIN_USER_ID => $user_id);
 //    	$this->db->where($data);
 //    	$this->db->join(T_USERS, T_USERS.'.'.USER_ID.' = '.T_GCMUSER.'.'.USER_ID , 'inner' ) ;
 //    	$query_result = $this->db->get();

 //    	$query_result = $query_result->result_array();
 //    	var_dump($query_result);exit();
 //    	return $query_result;
	// }

	/**
	 * get user by id
	 * @param  string  $select : fields of table need get
	 * @param  integer $id     id of user
	 * @return array|null
	 */
	public function get_data_by_id($id = -1, $select = '*'){

	}

	/**
	 * get data by property
	 * @param  string $select : fields of table need get
	 * @param  array  $where  conditions
	 * @return array|null
	 */
	public function get_data_by_property($where = array(), $select = '*'){

	}

	/**
	 * insert data into talbe
	 * @param array   $data   array data insert
	 * @param integer $result if 0 return id inserted else 1 return data user inserted
	 * @return null|integer|array
	 */
	public function set_data($data = array(), $result = 0){

	}

	/**
	 * update data by id
	 * @param  array   $data : data update
	 * @param  integer $id
	 * @return integer
	 */
	public function update_data_by_id($data = array(), $id = -1){

	}

	/**
	 * update data
	 * @param  array  $data
	 * @param  array  $where : conditions update
	 * @return integer
	 */
	public function update_data_by_property($data = array(), $where = array()){

	}

}